package main

import (
	"fmt"
	"net/url"
)

func p(i interface{}) {
	fmt.Println(i)
}
func main() {
	s := "http://www.baidu.com:80/console/index.php?key=test&value=test2"
	s1, err := url.Parse(s)
	if err != nil {
		p(s1)
	}

	p(s1.Scheme)
	p(s1.Host)
	p(s1.Path)
	p(s1.RawPath)
	p(s1.RawQuery)
	p("------")
	p(s1.Query()["key"][0])
	v, _ := url.ParseQuery(s1.RawQuery)
	p(v["key"][0])
	p("-------------------")
	s2 := url.Values{}
	s2.Add("key", "key1")
	s2.Add("val", "val1")
	p(s2)
	p(s2.Get("key"))
}
